
//Copyright 1997-2009 Syrinx Development, Inc.
//This file is part of the Syrinx Web Application Framework (SWAF).
// == BEGIN LICENSE ==
//
// Licensed under the terms of any of the following licenses at your
// choice:
//
//  - GNU General Public License Version 3 or later (the "GPL")
//    http://www.gnu.org/licenses/gpl.html
//
//  - GNU Lesser General Public License Version 3 or later (the "LGPL")
//    http://www.gnu.org/licenses/lgpl.html
//
//  - Mozilla Public License Version 1.1 or later (the "MPL")
//    http://www.mozilla.org/MPL/MPL-1.1.html
//
// == END LICENSE ==
using System;
using System.Xml;
using Swaf.Call;

namespace Swaf.Scheduler
{
	/// <summary>
	/// Defines the interface to interact with the scheduling system, defining methods to create and remove
	/// scheduled tasks and to stop processing the schedule.
	/// </summary>
	public interface IScheduleManager
	{
		/// <summary>
		/// Creates a scheduled task.<i>This does not modify the config file</i>
		/// </summary>
		/// <param name="taskId">Unique Identifier for the task to be scheduled</param>
		/// <param name="configInfo">Xml Node defining this task</param>
		void createScheduledTask(string taskId, XmlElement configInfo);
		
		/// <summary>
		/// Creates a scheduled task.<i>This does not modify the config file</i>
		/// </summary>
		/// <param name="taskId">Unique Identifier for the task to be scheduled</param>
		/// <param name="taskInfo">string containing the task definition</param>
		/// <param name="call">ICall instance to perform the work for this task</param>
		void createScheduledTask(string taskId, string taskInfo, ICall call);
		
		/// <summary>
		/// Schedules the specified task to execute.
		/// </summary>
		/// <param name="task"></param>
		void scheduleTask(IScheduledTask task);
		
		/// <summary>
		/// Removes an individual task (by id) from the scheduled tasks.  <i>This does not modify the config file</i>
		/// </summary>
		/// <param name="taskId">Unique Identifier for the task to be removed</param>
		void removeTask(string taskId);
		
		/// <summary>
		/// Removes all scheduled tasks.<i>This does not modify the config file</i>
		/// </summary>
		void clearAllTasks();
		
		/// <summary>
		/// Stops the ScheduleManager from executing any more tasks.
		/// </summary>
		void stop();

		int timerInterval{set;get;}
	}
}
